package top.healthylife.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.healthylife.domain.Member;

import java.util.List;
import java.util.Map;

/**
 * @author GaoZeXi
 */
public interface MemberMapper {
    /**
     * 根据手机号查询会员是否存在
     * @param telephone
     * @return
     */
    @Select("select * from t_member where phoneNumber = #{telephone}")
    Member findByTelephone(@Param("telephone") String telephone);


    @Insert("insert  into t_member(id,name,sex,idCard,phoneNumber,regTime) values (null," +
            "#{name},#{sex},#{idCard},#{phoneNumber},#{regTime})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    void add(Member member);

    Map findMemberCountByMonth(int year);
}
